
/*
 * Copyright (C) 2008-2009 Archie L. Cobbs. All rights reserved.
 *
 * $Id: FieldTypeSwitch.java 173 2009-11-10 17:08:19Z archie.cobbs $
 */

package org.dellroad.sidekar.classgen;

import org.dellroad.sidekar.ArrayField;
import org.dellroad.sidekar.BigIntegerField;
import org.dellroad.sidekar.BooleanField;
import org.dellroad.sidekar.ByteField;
import org.dellroad.sidekar.CharacterField;
import org.dellroad.sidekar.DateField;
import org.dellroad.sidekar.DoubleField;
import org.dellroad.sidekar.Field;
import org.dellroad.sidekar.FloatField;
import org.dellroad.sidekar.IntegerField;
import org.dellroad.sidekar.ListField;
import org.dellroad.sidekar.LongField;
import org.dellroad.sidekar.MapField;
import org.dellroad.sidekar.ReferenceField;
import org.dellroad.sidekar.SetField;
import org.dellroad.sidekar.ShortField;
import org.dellroad.sidekar.StringField;
import org.dellroad.sidekar.schema.model.ArrayFieldModel;
import org.dellroad.sidekar.schema.model.BigIntegerFieldModel;
import org.dellroad.sidekar.schema.model.BooleanFieldModel;
import org.dellroad.sidekar.schema.model.ByteFieldModel;
import org.dellroad.sidekar.schema.model.CharacterFieldModel;
import org.dellroad.sidekar.schema.model.DateFieldModel;
import org.dellroad.sidekar.schema.model.DoubleFieldModel;
import org.dellroad.sidekar.schema.model.FieldModelSwitch;
import org.dellroad.sidekar.schema.model.FloatFieldModel;
import org.dellroad.sidekar.schema.model.IntegerFieldModel;
import org.dellroad.sidekar.schema.model.ListFieldModel;
import org.dellroad.sidekar.schema.model.LongFieldModel;
import org.dellroad.sidekar.schema.model.MapFieldModel;
import org.dellroad.sidekar.schema.model.ReferenceFieldModel;
import org.dellroad.sidekar.schema.model.SetFieldModel;
import org.dellroad.sidekar.schema.model.ShortFieldModel;
import org.dellroad.sidekar.schema.model.StringFieldModel;

/**
 * Computes the type of the corresponding runtime {@link Field} representation.
 */
@SuppressWarnings("rawtypes")
class FieldTypeSwitch implements FieldModelSwitch<Class<? extends Field>> {

    public Class<? extends Field> caseReferenceFieldModel(ReferenceFieldModel fieldModel) {
        return ReferenceField.class;
    }

    public Class<? extends Field> caseSetFieldModel(SetFieldModel fieldModel) {
        return SetField.class;
    }

    public Class<? extends Field> caseMapFieldModel(MapFieldModel fieldModel) {
        return MapField.class;
    }

    public Class<? extends Field> caseListFieldModel(ListFieldModel fieldModel) {
        return ListField.class;
    }

    public Class<? extends Field> caseBooleanFieldModel(BooleanFieldModel fieldModel) {
        return BooleanField.class;
    }

    public Class<? extends Field> caseByteFieldModel(ByteFieldModel fieldModel) {
        return ByteField.class;
    }

    public Class<? extends Field> caseCharacterFieldModel(CharacterFieldModel fieldModel) {
        return CharacterField.class;
    }

    public Class<? extends Field> caseShortFieldModel(ShortFieldModel fieldModel) {
        return ShortField.class;
    }

    public Class<? extends Field> caseIntegerFieldModel(IntegerFieldModel fieldModel) {
        return IntegerField.class;
    }

    public Class<? extends Field> caseFloatFieldModel(FloatFieldModel fieldModel) {
        return FloatField.class;
    }

    public Class<? extends Field> caseDoubleFieldModel(DoubleFieldModel fieldModel) {
        return DoubleField.class;
    }

    public Class<? extends Field> caseLongFieldModel(LongFieldModel fieldModel) {
        return LongField.class;
    }

    public Class<? extends Field> caseStringFieldModel(StringFieldModel fieldModel) {
        return StringField.class;
    }

    public Class<? extends Field> caseDateFieldModel(DateFieldModel fieldModel) {
        return DateField.class;
    }

    public Class<? extends Field> caseBigIntegerFieldModel(BigIntegerFieldModel fieldModel) {
        return BigIntegerField.class;
    }

    public Class<? extends Field> caseArrayFieldModel(ArrayFieldModel fieldModel) {
        return ArrayField.class;
    }
}

